package com.hangzhou.welbeing.welbeinginstrument.utils;

import android.os.Handler;
import android.view.View;
import android.view.animation.TranslateAnimation;
import android.widget.TextView;

/**
 * 杭州惟君医疗科技有限公司16
 * Created by 20433 on 2018/1/29
 */

public class AnimationUtils {
    public static TranslateAnimation moveToViewBottom()
    {
        TranslateAnimation localTranslateAnimation = new TranslateAnimation(1, 0.0F, 1, 0.0F, 1, 0.0F, 1, 1.0F);
        localTranslateAnimation.setDuration(500L);
        return localTranslateAnimation;
    }

    public static TranslateAnimation moveToViewLocation()
    {
        TranslateAnimation localTranslateAnimation = new TranslateAnimation(1, 0.0F, 1, 0.0F, 1, 1.0F, 1, 0.0F);
        localTranslateAnimation.setDuration(500L);
        return localTranslateAnimation;
    }

    public static void showAndHide(final TextView paramTextView, String paramString)
    {
        paramTextView.setVisibility(View.VISIBLE);
        paramTextView.setText(paramString);
        paramTextView.setAnimation(moveToViewLocation());
        new Handler().postDelayed(new Runnable()
        {
            public void run()
            {
                paramTextView.setVisibility(View.GONE);
                paramTextView.setAnimation(AnimationUtils.moveToViewBottom());
                //isLoading = false;
            }
        }, 200L);
    }
}
